import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path";
import { viteMockServe } from 'vite-plugin-mock'

export default defineConfig({
  plugins: [
    react(),
    viteMockServe({
      mockPath: './mock', //mock文件地址
      enable: true,
      watchFiles: true,
      logger: true, //是否在控制台显示请求日志
    }),
  ],
  css: {
    // css预处理器
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      }
    },
    devSourcemap: true//默认为false
  },
  optimizeDeps: {
    exclude: ['js', 'ts', 'jsx', 'tsx'],//将指定数组中的依赖不进行依赖预构建
  },
  resolve: {
    alias: {
      "@": path.join(__dirname, "src"),
      "@components": path.join(__dirname, "src/components/"),
    },
  },
})
